package svc

import (
	"demohttp/internal/config"

	"gitee.com/fish2016/demorpc/demorpcclient"
	"gitee.com/unitedrhino/share/ctxs"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config        config.Config
	InitCtxsWare  rest.Middleware
	DemorpcClient demorpcclient.Demorpc
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:        c,
		InitCtxsWare:  ctxs.InitMiddleware,
		DemorpcClient: demorpcclient.NewDemorpc(zrpc.MustNewClient(c.DemorpcClient)),
	}
}
